﻿@{
    ViewBag.Title = "项目信息";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section htmlhead{
      <link href="~/assets/css/Layout/css/main.css" rel="stylesheet" />
    <link href="~/assets/css/plugin/validator.css" rel="stylesheet" />
    <script src="~/assets/js/swfobject.js"></script>
    <script src="~/assets/js/jquery.uploadify.v2.1.4.js"></script>
    <link href="~/Content/uploadify.css" rel="stylesheet" />
    <link href="~/assets/css/plugin/xjgrid.css" rel="stylesheet" />
    <style type="text/css">
        .cp_img {
    float: left;
    margin-right: 16px;
    position: relative;
}
    .cp_img img {
        width: 91px;
    height: 91px;
    }
        .shB {
        display:none;
        }
        #btnUploadImg {
        background-image:url(../../assets/img/upload.jpg);
        color:white;
        font-weight:300;
        padding:5px;
        }
    </style>
    }
@model LY.Entity.Entities.T_Project_EX
<div class="container">

    <div id="forms" class="mt10">
        <div class="box">
            <div class="box_border">
                <div class="box_top"><b class="pl15">@ViewBag.Title</b></div>
                <div class="box_center">
                    <form  id="frmEdit" method="post" action="@Url.Action("ProjectSave")" role="form" class="jqtransform">
                        <input id="id" name="id" value="@Model.ID" type="hidden" />
                        <input id="wid" name="wid" value="@Model.wid" type="hidden" />
                        <input id="rid" name="rid" value="@Model.rid" type="hidden" />
                        <input id="hideEName" name="hideEName" value="" type="hidden" />
                        <input id="Eid" name="Eid" value="@Model.EnterpriseID" type="hidden" />
                        <table class="form_table pt15 pb15" style="width: 100%;" border="0">
                            <tr>
                                <td class="td_right">项目编号：</td>
                                <td class="">@Model.ProjectNo
                                </td>
                                <td class="td_right">项目名称：</td>
                                <td class="">@Model.ProjectName
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">项目内容：</td>
                                <td class="">@Model.ProjectContent
                                </td>

                                <td class="td_right">借款总额：</td>
                                <td class="">@Model.TotalLoan
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">项目拆标：</td>
                                <td class="">
                                    @if (Model.SubProject == 1)
                                    {
                                        <span>是</span>
                                    }
                                    else
                                    {
                                        <span>否</span>
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">每标金额：</td>
                                <td class="">@Model.EachSubProjectAmount
                                </td>

                                <td class="td_right">最低额度：</td>
                                <td class="">@Model.MinTenderAmount
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">年化利率：</td>
                                <td class="">
                                    @(Model.AnnualisedRates * 100)%
                                </td>

                                <td class="td_right">企业名称：</td>
                                <td class="">
                                    <label id="lbEnterpriseName" title="@ViewBag.EnterpriseName">@ViewBag.EnterpriseName</label><input type="button" onclick="util.GetEnterpriseName(this.id)" id="btnAdd" name="button" class="btn btn82 btn_add" value="+">
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">企业代理人：</td>
                                <td class="">@Model.EnterpriseAgent
                                </td>

                                <td class="td_right">项目位置：</td>
                                <td class="">@Model.ProjectLocation
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">项目开始时间：</td>
                                <td class="">@Model.ProjectBeginDate
                                </td>
                                <td class="td_right">投标截止时间：</td>
                                <td class="">@Model.BiddingDeadline
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">借款用途：</td>
                                <td class="">@Model.LoanPurpose
                                </td>

                                <td class="td_right">还款来源：</td>
                                <td class="">@Model.RepaymentSource
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">借款类型：</td>
                                <td class="">
                                    @Html.ResourceDropDownList("LoanType", "LoanType", Model.LoanType, new { @class = "select" })
                                </td>
                                @*            </tr>
                   <tr>*@
                                <td class="td_right">项目期限：</td>
                                <td class="">@Model.ProjectDuration
                                    @if (Model.DurationMonthOrDay == 1)
                                    {
                                        <span>月</span>
                        
                                    }
                                    else
                                    {
                                        <span>天</span>
                        
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td><b class="pl15">风控信息</b></td>
                            </tr>
                            <tr>
                                <td class="td_right">担保方：</td>
                                <td class="">@Model.AssuranceProvider
                                </td>

                                <td class="td_right">担保情况：</td>
                                <td class="">@Model.AssuranceSituation
                                </td>
                            </tr>

                            <tr>
                                <td class="td_right">风控详情：</td>
                                <td class="" colspan="3">@Html.Raw(@Model.FKRemark)
                                </td>
                            </tr>
                            <tr>
                                <td><b class="pl15 td_right">相关文件</b></td>
                                <td>
                                    <input type="button" id="btnUploadImg" value=" 上传文件" />
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">企业实地照片：</td>
                                <td class="" colspan="3">
                                    <div id="fileList">
                                        <div id="div_img">
                                            @if (ViewBag.RelevantList != null)
                                            {
                                                foreach (var item in ViewBag.RelevantList)
                                                {
                                                <div>
                                                    <div id="@item.ID" class="cp_img">
                                                        <img class="imgShow" src="@item.EFPhotoPath" height='100' width='100'/>
                                                    </div>
                                                    <div style="line-height: 92px; margin-left: 825px;">
                                                        说明：
                                      <input type="text" name="EFPhotoExplains"  value="@item.EFPhotoExplain" class="etxt input-text lh30" size="40">
                                                        <input style="color:red;margin-left:10px;background-color:white;" type="button" onclick="util.Delete(@item.ID)" value="删除"/>
                                                        <input type="hidden" name="EFPhotoPath" value='@item.TitlePic/@item.EFPhotographs/@item.EFPhotoPath.Split('/')[2]' />
                                                    </div>
                                                </div>
                                                }
                                            }
                                        </div>
                                    </div>
                                    <div id="imgShowDiv" style="width: 650px; height: auto; margin: 0px auto; display: none; height: 650px; margin-top: 10px; border: 0px solid #808080; position: absolute;">
                                        <div id="imgClose" style="float: right; padding: 5px; font-weight: 800; font-size: 22px; background-color: #4d4d4d; cursor: pointer; color: white; border-radius: 20px; width: 40px; height: 40px;"><b>&nbsp;关 闭</b></div>
                                        <div>
                                            <img src="~/img/noimg.jpg" style="width: 610px; height: 610px; padding-left: 25px;" id="newImgShow" />
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">借款状态：</td>
                                <td class="">
                                    <input id="LoanStatu" disabled="disabled" value="@Model.LoanStatu"/>
                                </td>
                                <td class="td_right">还款状态：</td>
                                <td class="">
                                    <input id="RepaymentStatu" disabled="disabled" value="@Model.RepaymentStatu"/>
                                </td>

                            </tr>
                            <tr id="RepaymentTitle">
                                <td><b class="pl15 td_right">还款详情</b></td>
                            </tr>
                            <tr id="Repayment">
                                <td colspan="4">
                                    <div id="gridlist">
                                    </div>
                                </td>
                            </tr>

                            <tr id="RepaymentDetailTitle">
                                <td><b class="pl15 td_right">本期还款明细</b></td>
                            </tr>
                            <tr id="RepaymentDetail">
                                <td colspan="4">
                                    <div id="gridrepaymentlist">
                                    </div>
                                </td>
                            </tr>

                            <tr>
                                <td><b class="pl15 td_right">放款详情</b></td>
                            </tr>
                            <tr>
                                <td class="td_right">借款日期：</td>
                                <td class="">@Model.LoanTime
                                </td>

                                <td class="td_right">借款人：</td>
                                <td class="">@Model.LoanUser
                                </td>
                            </tr>

                            <tr>
                                <td><b class="pl15 td_right">项目审核</b></td>
                            </tr>
                            <tr>
                                <td class="td_right">审核说明：</td>
                                <td class="" colspan="3">@Model.AuditExplain
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">审核日期：</td>
                                <td class="">@Model.AuditTime
                                </td>

                                <td class="td_right">审核人：</td>
                                <td class="">@ViewBag.UserName
                                </td>
                            </tr>

                            <tr>
                                <td class="td_right"></td>
                                <td class=""></td>
                            </tr>
                            <tr>
                                <td class="td_center" colspan="5">
                                    @* <input type="button" id="btnBack" name="button" style="margin-right:50px;" class="btn btn82 btn_save2" value="退回"> 
                    <input type="button" id="btnAudit" name="button" style="margin-right:50px;" class="btn btn82 btn_save2" value="通过"> 
                    <input type="button" id="btnLoan" name="button" style="margin-right:50px;" class="btn btn82 btn_save2" value="放款"> *@
                                    @*<input type="button" id="btnRept" name="button" style="margin-right:50px;" class="btn btn82 btn_save2" value="还款"> *@
                                    <input type="button" id="btnReturn" name="button" class="btn btn82 btn_res" value="返回">
                                </td>
                            </tr>
                        </table>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div> 
@section jssection{
    <script type="text/javascript"> 
    var util = {}; 
    var options = {
        enterpriseUrl: "@Url.Action("EjectEnterPrise")",
        deleteUrl:"@Url.Action("RelementDelete")",
        @* uploadUrl: "@Url.Action("UpLoadProcess")",*@
        uploadUrl: "@Url.Action("UploadImg", "Helper")",
        Loan:"@Url.Action("Loan")",
        Audit:"@Url.Action("Audit")",
        Rept:"@Url.Action("Rept")",
        listUrl:"@Url.Action("RelementPlanList")",
        RepaymentlistUrl:"@Url.Action("RepaymentDetailList1")",
        
        Repayment:"@Url.Action("Repayment")"
    };

        $("#btnSave").click(function () {
            if ($('input[name="SubProject"]').filter(':checked').val() == "1") {
                if ($('#EachSubProjectAmount').val()!="") {
                    //$('#uploadify').uploadifyUpload();

                    var messcontent = UE.getEditor('editor').getContent();
                    $("#hideRemark").val(messcontent);
                    setInterval($("#frmEdit").submit(), 1000);
                }
                else
                {
                    alert('请填写每标金额！');
                }
            }
            else
            {
                var messcontent = UE.getEditor('editor').getContent();
                $("#hideRemark").val(messcontent);
                //$('#uploadify').uploadifyUpload();
                setInterval($("#frmEdit").submit(), 1000);
            }
        });
        function Remove(obj)
        {
            $(obj).parent("div").parent("div").remove();
        }
        $(document).ready(function () {
            //$("#uploadify").uploadify({
            //    'uploader': '../../Content/uploadify.swf',
            //    'script': options.uploadUrl+"?id="+$('#id').val(),
            //    'cancelImg': '../../Content/cancel.png',
            //    'folder': 'UploadFile',
            //    'queueID': 'fileQueue',
            //    'auto': false,
            //    'multi': true,
            //    'onComplete': function (event, ID, fileObj, response, data) {

            //        $('#div_img').after("&nbsp;&nbsp;&nbsp;<img src=" + response + " alt='' height='100' width='100' />")
            //    }
            //});
            //初始化图片上传  
            var btnImg = document.getElementById("btnUploadImg");
            g_AjxUploadImg(btnImg);

        });  

        var g_AjxTempDir = "/FileUpload/";
        //图片上传  
        function g_AjxUploadImg(btn) {
            var button = btn, interval;
            new AjaxUpload(button, {
                action: options.uploadUrl,
                data: {},
                name: 'myfile',
                onSubmit: function (file, ext) {
                    if (!(ext && /^(jpg|JPG|png|PNG|gif|GIF)$/.test(ext))) {
                        alert("您上传的图片格式不对，请重新选择！");
                        return false;
                    }
                },
                onComplete: function (file, response) {
                    flagValue = response;
                    if (flagValue == "-1") {
                        alert("您上传的图片格式不对，请重新选择！");
                    }
                    else if (flagValue == "-2") {
                        alert("您上传的图片大于2兆，请重新选择！");
                    }
                    else if (flagValue == "-3") {
                        alert("图片上传失败！");
                    }
                    else {

                        var strs = new Array();
                        strs = response.split("/");
                        
                        var oldname=strs[0];
                        var newname=strs[1];
                        var filepath=strs[2];


                        var src= g_AjxTempDir + filepath + "/" + newname;
                        //fileName.value = g_AjxTempDir + fileName2 + "/" + Pictures2;
                        var newimg=[];
                        newimg.push('<div><div class="cp_img" id="2679">');
                        newimg.push('<img class="imgShow" src=' + src + ' alt="" height="100" width="100" />');
                        newimg.push('</div>');
                        newimg.push('<div style="line-height: 92px; margin-left: 825px;">说明：');
                        newimg.push('<input name="EFPhotoExplains" class="etxt input-text lh30" type="text" size="40" value='+oldname.split('.')[0]+'>');
                        newimg.push('<input style="color: red; margin-left: 10px; background-color: white;" onclick="Remove(this)" type="button" value="删除">');
                        newimg.push('<input type="hidden" name="EFPhotoPath" value='+response+' />');
                        newimg.push('</div></div>');
                        $(newimg.join('')).appendTo('#div_img');
                    }
                }
            });
        }
    </script>

     <script src="~/ueditor/ueditor.config.js"></script>
    <script src="~/ueditor/ueditor.all.min.js"></script>

    <script src="~/assets/plugins/xjgrid/xjgrid.js"></script>
    <script src="~/assets/plugins/validator/validator.js"></script>
    <script src="~/assets/js/common.js"></script>
    <script src="~/assets/DatePicker/WdatePicker.js"></script>
    <script src="~/assets/layer/layer.min.js"></script>
    <script src="~/assets/app/common/ajaxupload.js"></script>
    <script src="~/assets/app/project/ProjectRepaymentDetail.js"></script>

     <script type="text/ecmascript">
         $(function () {
             var um = UE.getEditor('editor');
             //var mm = UE.getEditor("editor2");
             $(".imgShow").click(function (e) {
                 $("#newImgShow").attr("src", this.src);
                 var left = $(this).offset().left;
                 var top = $(this).offset().top;
                 $("#imgShowDiv").css({ "left": left, "top": top });
                 $("#imgShowDiv").show();
             });

             $("#imgClose").click(function () {
                 $("#imgShowDiv").hide();
             });

         });
    </script>
}
